#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if (id ==0)
    {
        int cnt =5;
        while(cnt)
        {
        printf("子进程,pid:%d,ppid:%d,cnt:%d\n",getpid(),getppid(),cnt);
        sleep(1);
        cnt--;
         }
        exit(0);
    }
    else
    {
        while(1)
        {
        printf("父进程,pid:%d,ppid:%d\n",getpid(),getppid());
        sleep(1);
        }
    }
    /*int a=0;
    printf("Enter:");
    scanf("%d",&a);
    printf("Echo:%d\n",a);
    while(1)
    {
        sleep(1);
        printf("hello\n");
    }*/
    return 0;
}
